<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output indent="yes" method="html"/>
        <xsl:template match="/*/com.transcargo.users.LongUser">
					<center><h1><xsl:value-of select="name"/></h1></center>
		            <table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
					<thead><tr bgcolor="#eeeeee"><th colspan="2">Информация об организации</th></tr></thead>
					<tbody><tr bgcolor="#ffffff"><td>Наименование:</td><td><xsl:value-of select="name"/></td></tr>
					<tr bgcolor="#ffffff"><td>Страна:</td><td><xsl:value-of select="country"/></td></tr>
					<tr bgcolor="#ffffff"><td>Город:</td><td><xsl:value-of select="city"/></td></tr>
					<tr bgcolor="#ffffff"><td>Юридический адрес:</td><td><xsl:value-of select="address"/></td></tr>
					<tr bgcolor="#ffffff"><td>Дата регистрации:</td><td><xsl:value-of select="registered"/></td></tr>
					<tr bgcolor="#ffffff"><td>Email:</td><td><xsl:value-of select="email"/></td></tr>
					<tr bgcolor="#ffffff"><td>Web:</td><td><xsl:value-of select="url"/></td></tr>
					</tbody></table><br/>
		            <table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
					<thead><tr bgcolor="#eeeeee"><th colspan="2">Заявки</th></tr></thead>
					<tbody><tr bgcolor="#ffffff"><td>Заявлено грузов:</td><td><xsl:value-of select="num__cargo"/></td></tr>
					<tr bgcolor="#ffffff"><td>Заявлено транспорта:</td><td><xsl:value-of select="num__freight"/></td></tr>
					<tr bgcolor="#ffffff"><td>Собственного автотранспорта:</td><td><xsl:value-of select="num__transports"/></td></tr>
					</tbody></table><br/>
			<xsl:if test="num__contacts &gt; 0">
		            <table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
					<thead><tr bgcolor="#eeeeee"><th colspan="2">Контакты</th></tr></thead>
					<tbody><tr bgcolor="#ffffff"><td><xsl:apply-templates select="contacts/com.transcargo.users.Contact"/>
					</td></tr>
					</tbody></table><br/>
			</xsl:if>
			<xsl:apply-templates select="rating"/>
        </xsl:template>
        <xsl:template match="rating">
		            <table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
					<thead><tr bgcolor="#eeeeee"><th colspan="2">Надежность компании</th></tr></thead>
					<tbody><tr bgcolor="#ffffff"><td>Рейтинг доверия:</td><td><xsl:value-of select="rating"/></td></tr>
					<tr bgcolor="#ffffff"><td>Отрицательных отзывов:</td><td><xsl:value-of select="count(feedbacks/com.transcargo.rating.Feedback/rating[text()='-1'])+count(feedbacks/com.transcargo.rating.Feedback/rating[text()='-2'])"/></td></tr>
					<tr bgcolor="#ffffff"><td>Нейтральных отзывов:</td><td><xsl:value-of select="count(feedbacks/com.transcargo.rating.Feedback/rating[text()='0'])"/></td></tr>
					<tr bgcolor="#ffffff"><td>Положительных отзывов:</td><td><xsl:value-of select="count(feedbacks/com.transcargo.rating.Feedback/rating[text()='1'])+count(feedbacks/com.transcargo.rating.Feedback/rating[text()='2'])"/></td></tr>
					<tr bgcolor="#ffffff"><td>Заявлений о долге:</td><td><xsl:value-of select="count(debts/com.transcargo.rating.Debt)"/></td></tr>
					</tbody></table><br/>
					<a><xsl:attribute name="href">addfeedback.jsp?uid=<xsl:value-of select="User__Id"/></xsl:attribute>Добавить отзыв</a><br/>
                    <br/><br/><xsl:apply-templates select="feedbacks/com.transcargo.rating.Feedback"/>
        </xsl:template>
        <xsl:template match="com.transcargo.users.Contact">
					<xsl:value-of select="name"/>&#160;&#160;&#160;
    	</xsl:template>
        <xsl:template match="com.transcargo.rating.Feedback">
        Добавлено: <xsl:value-of select="date"/><br/>
        От: <b><a><xsl:attribute name="href">company.jsp?id=<xsl:value-of select="author/Id"/></xsl:attribute><xsl:value-of select="author/name"/></a></b>, <xsl:value-of select="author/city"/>, <xsl:value-of select="author/country"/><br/>
	    Оценка:&#160;<xsl:if test="rating='-2'">Резко отрицательно</xsl:if><xsl:if test="rating='-1'">Негативно</xsl:if><xsl:if test="rating='0'">Нейтрально</xsl:if><xsl:if test="rating='1'">Положительно</xsl:if><xsl:if test="rating='2'">Великолепно</xsl:if><br/>
        ------<br/>
        <xsl:value-of select="feedback"/><br/><br/><br/>
    </xsl:template>

        <xsl:template match="/*/com.transcargo.users.ShortUser-array">
		<xsl:apply-templates select="com.transcargo.users.ShortUser"/>
    	</xsl:template>

	
        <xsl:template match="com.transcargo.users.ShortUser">
		<a><xsl:attribute name="href">javascript:getUser(<xsl:value-of select="Id"/>)</xsl:attribute><xsl:value-of select="name"/></a><br/>
		<xsl:value-of select="city"/>, <xsl:value-of select="country"/><br/>
		Телефон: <xsl:value-of select="phone"/><br/>
		Отзывы: <xsl:value-of select="num__feeds__good"/>/<xsl:value-of select="num__feeds__neutral"/>/<xsl:value-of select="num__feeds__bad"/><br/><br/><br/>
        </xsl:template>

</xsl:stylesheet>
